home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gekkan Dennou Club 143
/
Gekkan Dennou Club - 2000.4 Vol. 143 (Japan).7z
/
Gekkan Dennou Club - 2000.4 Vol. 143 (Japan).bin
/
ikap
/
grp1
/
smp1
/
spctest.c
< prev
next >
Wrap
C/C++ Source or Header
|
2000-03-06
|
3KB
|
169 lines
/*
*/
#include <stdio.h>
#include <stdlib.h>
#include <iocslib.h>
#include "structs.inc"
extern int HEI0[],HEI1[];
TASK ETask[MAX_ETASK]; /*クリック可能アイテム*/
int dispPage=0;
#define SetTask(tn,na,x,y,an) \
t=&ETask[(tn)]; \
t->disp0_addr=(na); \
t->disp0_x=(x)<<16; \
t->disp0_y=(y)<<16; \
t->disp0_anim=(an)
int Init000()
{
TASK *t;
CRTMOD(270);
HOME(0,0,0);
cls();
sp_init();
v_priority("TSG","0123");
sp_disp(1);
sp_on(0,127);
spfile_def("mue_m.SP",0x00); /*スプライト読み込み*/
palfile_def("mue.PAL",0x01);
/* t=&ETask[0]; t->disp0_addr=YOUW; t->disp0_x=128<<16; t->disp0_y=128<<16; t->disp0_anim=0; */
SetTask(0,HEI0,128, 96,0);
SetTask(1,HEI1,132,160,0);
}
/*----------------------------------------------------------------------SyncMan()*/
#define X6sp_set(pl,x,y,n,p) \
X6sync_buf[(pl)*4+0]=(x); \
X6sync_buf[(pl)*4+1]=(y); \
X6sync_buf[(pl)*4+2]=(n); \
X6sync_buf[(pl)*4+3]=(p)
short X6sync_buf[128*4];
int SyncMan()
{
int ssp;
short d,sppl;
short tn,sn,an,px,py,pat;
TASK *t; /*通常タスク*/
SPINFO *s;
ssp=B_SUPER(0);
sppl=0;
/*敵機
*/
for( tn=0;tn<MAX_ETASK;tn++ ){
t=&ETask[tn];
/* if( t->func_addr==NULL ){ continue; } */
if( t->disp0_addr==NULL ){ continue; }
s=t->disp0_addr;
if( s==NULL ){ continue; }
/*以下、表示
*/
an=t->disp0_anim;
px=*(short *)&(t->disp0_x);
py=*(short *)&(t->disp0_y);
for( sn=0;sn<s->anim_info[t->disp0_anim]->chips;sn++ ){
px+=s->anim_info[t->disp0_anim]->splink[sn].ox;
py+=s->anim_info[t->disp0_anim]->splink[sn].oy;
pat=s->anim_info[t->disp0_anim]->splink[sn].patnum;
if( t->disp0_palet!=0 ){
pat&=0xf0ff;
pat=pat|(t->disp0_palet<<8);
}
X6sp_set(
sppl, /*実際に描画されるSPプレーン*/
px,
py,
pat,
3
);
sppl++;
}
}
/*スクロール
*/
{
int pn;
unsigned short *spscr=0xEB0000,
*sync=X6sync_buf;
for( pn=0;pn<min(sppl,128);pn++ ){
*spscr++=(*sync+16);sync++;
*spscr++=(*sync+16);sync++;
*spscr++=*sync++;
*spscr++=*sync++;
}
sp_off(sppl,127);
}
{
unsigned short *vctrl_r2=0xE82600;
*vctrl_r2|=0x0040;
}
B_SUPER(ssp);
}
int voffwait(times)
int times;
{
volatile unsigned char *gpip=0xe88001;
int t,ssp;
ssp=B_SUPER(0);
for( t=0;t<times;t++ ){
while((*gpip&0x10));
while(!(*gpip&0x10));
}
B_SUPER(ssp);
}
main(argc,argv)
int argc;
char *argv[];
{
int mn0,mn1;
Init000();
mn0=(ETask[0].disp0_addr)->max_anim;
mn1=(ETask[1].disp0_addr)->max_anim;
while( BITSNS(0)!=0x02 ){
SyncMan();
ETask[0].disp0_anim=(ETask[0].disp0_anim<mn0-1)?ETask[0].disp0_anim+1:0;
ETask[1].disp0_anim=(ETask[1].disp0_anim<mn1-1)?ETask[1].disp0_anim+1:0;
if( argc!=1 ){ voffwait(atoi(argv[1])); }
else{ getch(); }
}
while( BITSNS(0)==0x02 );
KFLUSHIO(0xff);
}
/* [ EOF ] */